<?php

require_once '../include/common.inc.php';

if (!checkAdmin()) {
    header("LOCATION:index.php");
    exit;
}

$menu_index = 1;
$page_title = 'TABLA';
$guide_message = 'Product | Basic Information | Add';
$name = (isset($_POST['code'])) ? $_POST['code'] : "";


getMyParam('code');


//type
$sql = "SELECT `id`, `name` FROM `pro_type` ORDER BY `orders` ASC";
$query = $db->query($sql);
while($rs = $db->fetch_array($query)) {

	$type_select.= "<tr class='tbcontent1'>
                      <td align='left'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='checkbox' name='type_id[]' value='$rs[id]'/>$rs[name]</td>
                      </tr>";		
}

//category
$sql = "SELECT `id`, `name` FROM `pro_category` ORDER BY `orders` ASC";
$query = $db->query($sql);
while($rs = $db->fetch_array($query)) {

	$category_select.= "<tr class='tbcontent1'>
                      <td align='left'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='checkbox' name='category_id[]' value='$rs[id]'/>$rs[name]</td>
                     </tr>";
		
}

//Publisher
$sql = "SELECT `id`, `name` FROM `pro_publisher` ";
$query = $db->query($sql);
while($rs = $db->fetch_array($query)) {
	$publisher_select.= "<option value='$rs[id]'>".$rs[name];
}

//Author
$sql = "SELECT `id`, `name` FROM `pro_author` ";
$query = $db->query($sql);
while($rs = $db->fetch_array($query)) {
	$author_select.= "<option value='$rs[id]'>".$rs[name];
}

//Supplier
$sql = "SELECT `id`, `name` FROM `pro_supplier` ";
$query = $db->query($sql);
while($rs = $db->fetch_array($query)) {
	$supplier_select.= "<option value='$rs[id]'>".$rs[name];
}
//order 
$sql_order ="SELECT max(orders) +1 FROM `pro_product`";
//echo $sql_order;
$ary_order=$mysql->fetch($sql_order);
$order=$ary_order[0][0];
//vat
$sql_vat="select vat from pro_product where vat<>'' ";
$ary_vat=$mysql->fetch($sql_vat);
$vat_created=$ary_vat[0][0];

include_once('menu_list.php');
require_once PrintEot('a_header');
require_once PrintEot('a_p_product_add');
require_once PrintEot('a_footer');

?>